Fun with Type Functions

نویسندگان

  • Oleg Kiselyov
  • Simon L. Peyton Jones
  • Chung-chieh Shan
چکیده

Tony Hoare has always been a leader in writing down and proving properties of programs. To prove properties of programs automatically, the most widely used technology today is by far the ubiquitous type checker. Alas, static type systems inevitably exclude some good programs and allow some bad ones. This dilemma motivates us to describe some fun we’ve been having with Haskell, by making the type system more expressive without losing the benefits of automatic proof and compact expression. Haskell’s type system extends Hindley-Milner with two distinctive features: polymorphism over type constructors and overloading using type classes. These features have become integral to Haskell, and they are widely used and appreciated [29]. More recently, Haskell has been enriched with type families [6, 7, 43], which allows functions on types to be expressed as straightforwardly as functions on values. This facility makes it easier for programmers to effectively extend the compiler by writing functional programs that execute during type-checking. This paper gives a programmer’s tour of type families as they are supported in GHC today. This is the second major iteration of our paper. We warmly encourage feedback on this draft, prior to publication. Please add comments to the Wiki page at http: // haskell. org/ haskellwiki/ Simonpj/ Talk: FunWithTypeFuns .

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Identifying Factors Affecting Fun in Workplace with Ethnography Approach

The purpose of this study is to identifying factors affecting Fun in Workplace in Army Physical Training Corps.The study type is developmental and mix method and to extract factors, ethnography methodology that is a qualitative method was used. To extract factors, ethnography methodology was used. Statistical population in this study consists of Army Physical Training Corps. In quantitative sec...

متن کامل

Local Type Argument Synthesis with Bounded Quanti cation

In a companion paper [PT98], we introduced a local type inference method for inferring type arguments to polymorphic functions. We show here how our method can be extended to handle Cardelli and Wegner's Kernel Fun variant of F .

متن کامل

Programs and Proofs Mechanizing Mathematics with Dependent Types Lecture Notes

ing away from the details, we can see that nat rect is indeed a function with three parameters (the keyword fun is similar the lambda notation and is common in the family of ML-like languages). The body of nat rect is implemented as a recursive function (defined via the keyword fix) taking an argument n of type nat. Internally, it proceeds similarly to our implementation of my plus: if the argu...

متن کامل

Inheritance as Implicit Coercion

We present a method for providing semantic interpretations for languages with a type system featuring inheritance polymorphism. Our approach is illustrated on an extension of the language Fun of Cardelli and Wegner, which we interpret via a translation into an extended polymorphic lambda calculus. Our goal is to interpret inheritances in Fun via coercion functions which are definable in the tar...

متن کامل

Games provide fun(ctional programming tasks)!

When teaching a computer science course to non computer science students, it is often difficult to motivate these students. Intriguing examples and tasks may help in doing so. We often use games as the topic of our tasks, because the fun part increases the students’ enthusiasm. In the talk we present two particularly successful mind games. In Apollo 13 the player tries to make a safe landing on...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 2010